{extend name="common/application" /}
{block name="title"}<title id="title">交易市场-交易商品详情</title>{/block}
{block name="css"}
<link rel="stylesheet" type="text/css" href="_CSS_/service_details.css"/>
<style type="text/css">
    .storeName{width: 255px;}
    #num {
        color: #333333;
        font-size: 14px;
    }

    .intros {
        height: auto;
    }

    #productName{
        font-size: 20px;
    }

    .quoteBtn {
        width: 176px;
        height: 48px;
        line-height: 48px;
        margin-top: 35px;
        font-size: 16px;
        color: #FFFFFF;
        background: #FF4900;
        text-align: center;
        display: inline-block;
    }

    .quoteBtn:hover {
        color: #FFFFFF;
    }

    #prices,.prices {
        font-size: 18px;
        color: #ff4900;
    }

    .tab_con_item {
        margin: 15px 0;
        padding: 0 10px;
    }

    .table {
        text-align: center;
        border-collapse: collapse;
        color: #333333;
        font-size: 14px;
    }

    .table th, .table td {
        padding: 5px 9px;
        vertical-align: middle;
        border: 1px solid #C5C5C5;
        background: #F4F4F4;
        font-weight: normal;
    }

    .table td {
        color: #666666;
    }

    .sp1 {
        width: 34px;
        height: 16px;
        background-color: #17c6ac;
        color: #ffffff;
        font-size: 12px;
        line-height: 16px;
        text-align: center;
        margin-right: 10px;
    }

    .special {
        color: #FF4900 !important;
    }

    #table2 th, #table2 td {
        padding: 5px 26px;
    }

    .tab_item p {
        margin: 10px 0 30px;
        color: #333333;
    }

    .tab_item a {
        color: #3377C1;
    }
.text{
        padding-top: 15px;
        width: 176px;
        height: 48px;
        line-height: 48px;
        margin-top: 44px;
        font-size: 16px;
        color: #FFFFFF;
        background: #FF4900;
        text-align: center;
        display: inline-block;
    }
    .productsArea {
        width: 770px;
    }
	.storeName {width:255px;}
	.bshare-custom{display:inline-block;}
	.collectArea{margin-left:40px;}
</style>
<!--[if lt IE 9]>
<script src="http://www.ijquery.cn/js/html5shiv.js"></script>
<![endif]-->
{/block}

{block name="navbar"}{include file="/common/navbar" /}{/block}
{block name="content"}
<!-- 主体内容 -->
<div class="main" style="padding-top: 10px;margin-top:190px;">
    <div class="mainBody normalBox clearfix" style="padding-top: 0px;">
        <div class="menuConHeader">
            <!--面包屑导航-->
            <div class="breadcrumb" style="margin-bottom: 10px;">
                <p>当前位置：
                    <a href="{:url('index/trade/index')}">交易市场</a> &gt;
                    <a class="curPage" href="javascript:;">交易商品详情</a>
                </p>
            </div>
        </div>
        <div style="overflow: hidden;">
            <div class="productsArea fl">
                <div class="imgBox fl">
                    <img id="image" src=""/>
                     <!-- <div class="shareArea" style="position: relative;">
                        <span class="icons icon-share01"></span>
                        <span class="icons icon-share01-hover hide"></span>
                        <span class="isShare">分享商品</span>
                        <div class="shareType">
							<a class="qq" href="javascript:;" data-index="1">
								<span class="icons icon-qq"></span>
								<span class="icons icon-active-qq hide"></span>
							</a>
							<a class="wx" href="javascript:;" data-index="2">
								<span class="icons icon-wx"></span>
								<span class="icons icon-active-wx hide"></span>
							</a>
							<a class="wb" href="javascript:;" data-index="3">
								<span class="icons icon-wb"></span>
								<span class="icons icon-active-wb hide"></span>
							</a>
							<div class="ercodeBox">
								<input id="text" type="text" class="hide"/>
								<div id="qrcode"></div>
							</div>
						</div>
                        <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>
                    </div>
					-->
					<div class="bshare-custom">
						<a title="分享到QQ空间" class="bshare-qzone"></a>
						<a title="分享到新浪微博" class="bshare-sinaminiblog"></a>
						<a title="分享到人人网" class="bshare-renren"></a>
						<a title="分享到腾讯微博" class="bshare-qqmb"></a>
						<a title="分享到网易微博" class="bshare-neteasemb"></a>
						<a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>
						<span class="BSHARE_COUNT bshare-share-count">0</span>
					</div>
					<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&amp;uuid=&amp;pophcol=2&amp;lang=zh"></script>
					<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>
                    <a class="collectArea" href="javascript:;">
                        <span class="icons icon-collect01"></span>
                        <span class="icons icon-collect01-hover hide"></span>
                        <span class="icons icon-collect01-success hide"></span>
                        <span class="isCollect">收藏</span>
                    </a>
                </div>
                <div class="productsInfo fl">
                    <span id="productName"></span>
                    <p><label>专利号</label><span id="num"></span></p>
                    <p><label>价格</label><span id="prices"></span></p>
                    <div class="nums">
                        <p class="volume">授权量<span class="num01"></span></p>
                    </div>
                    <div class="intros">
                        <p><label>类型</label><span class="type">交易类</span></p>
                        <p><label>交易方式</label><span class="type" id="market_cid"></span></p>
                        <p><label>行业分类</label><span class="type" id="trading_category"></span></p>
                    </div>
                    <div id="text">
                        <a class="quoteBtn" href="javascript:;">立即报价</a>
                    </div>
                    <div class="extraInfo">
                        <label>服务承诺</label>
                        <p><span class="icons icon-pundit"></span>权威正规</p>
                        <!--<p><span class="icons icon-trust"></span>专业可靠</p>
                        <p><span class="icons icon-aftersale"></span>优质售后</p>-->
                        <br/>
                        <label>支付方式</label>
                        <p><span class="icons icon-alipay"></span>支付宝</p>
                    </div>
                </div>
            </div>
            <div class="storeArea fr">
                <div class="basicInfo">
                    <a class="storeLogo userImg" href="javascript:;">
                        <img src="_IMG_/76.png" class="icon-wapper hide">
                        <img id="images" src="_IMG_/store.jpg" class="icon">
                    </a>
                    <h4 class="storeName text_overflow"></h4>
                    <p>卖家：<span class="sellerman"></span></p>
                    <br>
                    <span class="icons sp1"></span>
                    <span class="icons icon-ensure"></span>
                </div>
                <!--<div class="basicInfo">-->
                    <!--<a class="storeLogo" href="store_details.html">-->
                        <!--<img src="images/76.png" class="icon-wapper">-->
                        <!--<img src="images/head01.png" class="icon">-->
                    <!--</a>-->
                    <!--<h4 class="storeName"></h4>-->
                    <!--<p>卖家：<span class="sellerman"></span></p>-->
                    <!--<br/>-->
                    <!--<span class="icons sp1"></span>-->
                    <!--<span class="icons icon-ensure"></span>-->
                <!--</div>-->
                <p>成交量<span id="sum"></span>次</p>
                <p>本店铺一共<span class="count"></span>件商品，其中交易类商品<span class="count"></span>件，服务类商品<span
                        class="count"></span>件。</p>
                <p id="label">
                </p>
                <!--<p>主营：专利转让、商标版权与专利转让专利转让、商标版权与专利转让专利转让、商标版权与专利转让专利转让、商标版权与专利转让</p>-->
                <a class="goStore" href="javascript:;">进店逛逛</a>
                <input type="hidden" id="king">
                <input type="hidden" id="user_id">
                <a class="contactStore" href="javascript:;">联系卖家</a>
            </div>
        </div>
        <!--左侧推荐区-->
        <div class="leftCon">
            <div class="recommendArea trades">
                <div class="recommendHeader">
                    <span class="fl">推荐交易</span>
                    <a class="refreshBtn fr" href="javascript:;"><span class="icons icon-refresh"></span></a>
                </div>
                <div class="recommendCon">
                </div>
            </div>
            <div class="recommendArea trades mt20">
                <div class="recommendHeader">
                    <span class="fl">看了又看</span>
                    <a class="refreshBtn fr" href="javascript:;"><span class="icons icon-refresh"></span></a>
                </div>
                <div class="recommendCon">
                </div>
            </div>
        </div>
        <!--右侧详情及评论区-->
        <div class="rightCon">
            <div class="tabs tab_navi">
                <a class="tabs_nav on" href="javascript:;" value="1">商品详情</a>
                <!--<a class="tabs_nav" href="javascript:;" value="2">累计评论<span class="commentsNum">26</span></a>-->
            </div>
            <div class="tab_content">
                <div class="tab_con" id="tab1">
                    <div class="tab_item">
                        <div class="tab_details">
                            <p><label for="storeNames">商品所属店铺：</label><span class="storeNames"></span></p>
                            <span class="productInfoTitle">商品详细信息：</span>
                            <p class="one_third"><label for="serviceType">交易方式：</label><span
                                    class="serviceType"></span></p>
                            <p class="one_third"><label for="updateTime">更新时间：</label><span class="updateTime"></span>
                            </p>
                            <p class="one_third"><label for="groundingTime">上架时间：</label><span
                                    class="groundingTime"></span>
                            </p>
                            <p class="one_third"><label for="serviceDetails">行业分类：</label><span
                                    class="serviceDetails"></span>
                            </p>
                            <p class="one_third"><label for="overdueTime">过期时间：</label><span class="overdueTime"></span>
                            </p>
                            <span class="productInfoTitle">商品详细信息：</span>
                            <p class="product_intro"></p>
                        </div>
                    </div>
                    <div class="tab_item mt20" id="patent_a">
                        <h5>专利质量评价</h5>
                        <div class="tab_con_item">
                            <table class="table" id="table1">
                                <tbody>
                                <tr>
                                    <th>专利号</th>
                                    <th>发明名称</th>
                                    <th>所在技术领域</th>
                                    <th>申请人</th>
                                    <th>权项布局度</th>
                                    <th>主权范围度</th>
                                    <th>技术综合度</th>
                                    <th>确权滞后度</th>
                                    <th>详尽全面度</th>
                                    <th>所在小类平均分</th>
                                    <th class="special">总分</th>
                                </tr>

                                <tr class="patent_a">
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="special"></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>

                    <div class="tab_item mt20" id="patent">
                        <h5>专利成果匹配</h5>
                        <div class="tab_con_item">
                            <table class="table" id="table2">
                                <tbody>
                                <tr>
                                    <th rowspan="2">专利号</th>
                                    <th rowspan="2">总匹配度</th>
                                    <th colspan="4" class="special">匹配结果</th>
                                </tr>
                                <tr>
                                    <th>发明名称</th>
                                    <th>涉及行业</th>
                                    <th>需求匹配企业或个人</th>
                                    <th>需求匹配度</th>
                                </tr>
                                <tr id="order">
                                    <td rowspan="6"></td>
                                    <td rowspan="6"></td>
                                    <td rowspan="6"></td>
                                    <td rowspan="6"></td>
                                </tr>

                                </tbody>
                            </table>
                            <p>想要查看更多匹配结果请进此网站<a href="http://www.ahips.cn" target="_blank">www.ahips.cn</a></p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="js"}
<!-- 脚本引入 -->
<script src="_P_/layer/layer.js"></script>
<script src="_JS_/jquery.qrcode.min.js"></script>
<script src="_JS_/train_details.js"></script>
<script type="text/javascript" src="_JS_/time.js"></script>
<script>
    $(function () {
        var url = window.location.href;
        id = url.split("=")[1];
		
		if(id == undefined || id == ''){
			var html='<div class="nodatas"><img src="/static/web/images/nodata.png"/><p>抱歉，找不到相关数据</p></div>';
					$('.mainBody').html(html);
		}else{
        postfile(id);
        hot_view();
        value_view();
        //获取登录信息
        var userinfo = $.cookie('userinfo');
        var value = $.cookie('views');
        if (userinfo != null || value != '') {
            var user_login = $.base64.decode(userinfo).split(",");
            var user_uid = user_login[0];
            $.ajax({
                type: "get",
                url: "/index.php/api/news/user_information",
                data: {'id': user_uid,'type':1},
                dataType: 'jsonp',
                success: function (msg) {
                    if (msg.code == 200) {
                        if (msg.data.indexOf(parseInt(id)) !== -1) {
                            $('.icon-collect01').addClass('hide');
                            $('.icon-collect01-hover').addClass('hide');
                            $('.icon-collect01-success').removeClass('hide');
                            isCollect = true;
                            collect = 1;
                            $('.isCollect').text('已收藏');
                            $('.isCollect').css('color', '#3377C1');
                        } else {
                            $('.icon-collect01').removeClass('hide');
                            $('.icon-collect01-hover').addClass('hide');
                            $('.icon-collect01-success').addClass('hide');
                            isCollect = false;
                            collect = 0;
                            $('.isCollect').text('收藏');
                            $('.isCollect').css('color', '#CCCCCC');
                        }
                    }
                }
            })
        }
        if (value != null || value != '') {
            $('.recommendArea').eq(1).show();
        } else {
            $('.recommendArea').eq(1).hide();
        }
		}
    });

    function value_view() {
        $.ajax({
            type: 'GET',
            url: "{:url('api/trading/value_views')}",
            dataType: 'jsonp',
            jsonp: 'callback',
            data: {id: id},
            success: function (msg) {
                if (msg.code == 200) {
                    value_666(msg.data);
                } else {
                    layer.msg('查询失败!', {icon: 1, time: 1000});
                }
            }
        })
    }

    /**
     * 看了又看
     * */
    function value_666(id) {
        $.ajax({
            type: 'GET',
            url: "{:url('api/trading/trading_shop')}",
            dataType: 'jsonp',
            jsonp: 'callback',
            data: {id: id},
            success: function (msg) {
                var html = "";
                if (msg.code == 200) {
                    for (var i = 0; i < msg.data.length; i++) {
						var price_num = number_format(msg.data[i].store, 2, ".", ",");
                        html += '<div class="items">' +
                            '<a class="links" href="trade_details.html?id=' + msg.data[i].id + '">' +
                            '<img src="/Images/tradingMarket/' + msg.data[i].image + '"' +
                            ' alt="' + msg.data[i].username + '"/></a><div class="borderLine">' +
                            '<span class="prices">￥' + price_num + '起</span>' +
                            '<a class="itemsTitle text_overflow" href="trade_details.html?id=' + msg.data[i].id + '"' +
                            ' title="' + msg.data[i].username + '">' + msg.data[i].username + '</a></div></div>';
                    }
                    $('.recommendCon').eq(1).html(html);
                } else {
                    layer.msg('查询失败!', {icon: 1, time: 1000});
                }
            }
        })
    }

    /**推荐交易服务**/
    function hot_view() {
        $.ajax({
            type: "get",
            url: "{:url('api/trading/trading_rand')}",
            data: {'number': 2, 'order': 'rand()'},
            dataType: 'jsonp',
            success: function (msg) {
                var html = "";
                if (msg.code == 200) {
                    for (var i = 0; i < msg.data.length; i++) {
						var price_num = number_format(msg.data[i].store, 2, ".", ",");
                        html += '<div class="items">' +
                            '<a class="links" href="trade_details.html?id=' + msg.data[i].id + '">' +
                            '<img src="/Images/tradingMarket/' + msg.data[i].image + '"' +
                            ' alt="' + msg.data[i].username + '"/></a><div class="borderLine">' +
                            '<span class="prices">￥' + price_num + '起</span>' +
                            '<a class="itemsTitle text_overflow" href="trade_details.html?id=' + msg.data[i].id + '"' +
                            ' title="' + msg.data[i].username + '">' + msg.data[i].username + '</a></div></div>';
                    }
                    $('.recommendCon').eq(0).html(html);
                }
            }
        });
    }

    $('.icon-refresh').eq(0).on('click', function () {
        hot_view();
    });

    $('.icon-refresh').eq(1).on('click', function () {
        value_view();
    });


    $(".goStore").on('click', function () {
        var id = $("#king").val();
        window.location.href = "{:url('index/trade/center')}?" + id
    })

    function postfile(id) {
		
			$.ajax({
				type: 'GET',
				url: "{:url('api/trading/trading_details')}",
				dataType: 'jsonp',
				jsonp: 'callback',
				data: {id: id},
				success: function (msg) {
					if (msg.code == 200) {
					if (msg.data.caking == 2) {
                        $('#text').html("<p class='text'>未上架商品</p>");
                    } else if (msg.data.static == 2 && msg.data.status == 2) {
                        $('#text').html("<p class='text'>未上架商品</p>");
                    } else if (msg.data.static == 3) {
                        $('#text').html("<p class='text'>审核未通过商品</p>");
                    } else if (msg.data.static == 1) {
                        $('#text').html("<p class='text'>待审核商品</p>");
                    } else if (msg.data.static == 2 && msg.data.status == 1) {
						
					}
						if (msg.data.s_id == 1) {
							$(".sp1").text('个人');
						}else{
							$(".sp1").text('企业');
						}
						$('#user_id').val(msg.data.user_id);
						$("#image").attr('src', "/Images/tradingMarket/" + msg.data.image);
						if (msg.data.images == null) {
							$("#images").attr('src', "/static/web/images/store.jpg");
						} else {
							$("#images").attr('src', "/Images/Information/" + msg.data.images);
						}
						$("#productName").html(msg.data.user);
						$('#num').html(msg.data.order);
						var price_num = number_format(msg.data.store, 2, ".", ",");
						$('#prices').html('￥' + price_num + '起');
						$('#trading_category').html(msg.data.market_name);
						$('#market_cid').html(msg.data.trading_name);
						$('.storeName').html(msg.data.name);
						$('.sellerman').html(msg.data.username);
						$('.num01').html(msg.data.volist);
						$('#sum').html(msg.data.shop_volume);
						$('.storeNames').html(msg.data.name);
						$('.count').eq(0).html(msg.data.trading_count + msg.data.service_count);
						$('.count').eq(1).html(msg.data.trading_count);
						$('.count').eq(2).html(msg.data.service_count);
						$(".sp1").html(msg.data.shop_name);
						$('.serviceType').html(msg.data.trading_name);
						$('.updateTime').html(getMyDate(msg.data.time * 1000));
						$('.overdueTime').html(getMyDate(msg.data.be_time * 1000));
						$('.groundingTime').html(getMyDate(msg.data.on_time * 1000));
						$('.serviceDetails').html(msg.data.market_name);
						$('.product_intro').html(msg.data.content);
						$("#king").val(msg.data.shop_id);
						$("#label").html("");
						if (msg.data.label.length > 0) {
							for (var i = 0; i < msg.data.label.length; i++) {
								if ($.inArray(msg.data.label[i].id + '', msg.data.shop_label) != -1) {
									$('#label').append('<span class="labels">' + msg.data.label[i].name + '</span>');
								}
							}
						}
                        if (msg.data.patent_a) {
                            $(".patent_a").find('td').eq(0).html(msg.data.patent_a.order);
                            $(".patent_a").find('td').eq(1).html(msg.data.patent_a.FMMC);
                            $(".patent_a").find('td').eq(2).html(msg.data.patent_a.ZIPC_TECH);
                            $(".patent_a").find('td').eq(3).html(msg.data.patent_a.SQR);
                            $(".patent_a").find('td').eq(4).html(msg.data.patent_a.P1);
                            $(".patent_a").find('td').eq(5).html(msg.data.patent_a.P2);
                            $(".patent_a").find('td').eq(6).html(msg.data.patent_a.P3);
                            $(".patent_a").find('td').eq(7).html(msg.data.patent_a.P4);
                            $(".patent_a").find('td').eq(8).html(msg.data.patent_a.P5);
                            $(".patent_a").find('td').eq(9).html(msg.data.patent_a.AVG_P);
                            $(".patent_a").find('td').eq(10).html(msg.data.patent_a.total);
                        } else {
                            $("#patent_a").hide();
                        }
                        if (msg.data.patent_b) {
                            $("#order td").eq(0).html(msg.data.patent_b.order);
                            $("#order td").eq(1).html(msg.data.patent_b.TOTAL_COUNT);
                            $("#order td").eq(2).html(msg.data.patent_b.FMMC);
                            $("#order td").eq(3).html(msg.data.patent_b.IND_FIELD);
                            if (msg.data.patent_b.res) {
                                html = '';
                                for (var i = 0; i < msg.data.patent_b.res.length; i++) {
                                    html += '<tr>' +
                                        '<td>' + msg.data.patent_b.res[i].XQR + '</td><td>' + msg.data.patent_b.res[i].MATCH_CNT + '</td>' +
                                        '</tr>';
                                }
                                $("#table2 tbody").append(html);
                            }
                        } else {
                            $("#patent").hide();
                        }
					} else {
						var html='<div class="nodatas"><img src="/static/web/images/nodata.png"/><p>抱歉，找不到相关数据</p></div>';
						$('.mainBody').html(html);
					}
				}
			})
		}
    

    /*联系卖家*/
    $('.contactStore').on('click', function () {
        var userinfo = $.cookie('userinfo');
        if (userinfo) {
            var user_login = $.base64.decode(userinfo).split(",");
            var from_uid = user_login[0];
            layer.open({
                type: 2,
                title: '联系卖家',
                fix: false,
                maxmin: true,
                shadeClose: true,
                scrollbar: false,
                area: ['560px', '490px'],
                content: 'contact_customer.html?id=' + id,
                btn: ['发送', '取消'],
                yes: function (index, layero) {
                    //do something

                    var body = layer.getChildFrame('body', index);
                    var content = body.find('#news_title').val();
                    var to_uid = $("#user_id").val();

                    layer.close(index);//如果设定了yes回调，需进行手工关闭
                    if (content != '' || title != '') {
                        $.ajax({
                            type: "get",
                            url: "{:url('api/trading/goods_chat')}",
                            data: {
                                'to_uid': to_uid,
                                'content': content,
                                'from_uid': from_uid,
                                'id': id
                            },
                            dataType: 'jsonp',
							beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
							},
                            success: function (msg) {
                                layer.closeAll();
                                if (msg.code == 200) {
                                    layer.msg('发送成功！', {icon: 1}, function () {
                                    });
                                }
                                if (msg.code == 1000) {
                                    layer.msg('发送失败！', {icon: 5});
                                }
                            }
                        });
                    } else {
                        layer.msg('不能为空！', {icon: 5});
                    }
                }
            });
        } else {
            layer.msg('你还没有登录！', {icon: 51});
        }
    });
    $('.quoteBtn').on('click', function () {
        var userinfo = $.cookie('userinfo');
        if (userinfo != null) {
            var user_login = $.base64.decode(userinfo).split(",");
            var user_uid = user_login[0];
            $.ajax({
                type: "get",
                url: "{:url('api/trading/trading_type')}",
                data: {'mid': id, 'uid': user_uid},
                dataType: 'jsonp',
                success: function (msg) {
                    if (msg.code == 200) {
                        layer.open({
                            type: 2,
                            title: '商品报价',
                            fix: false,
                            maxmin: true,
                            shadeClose: true,
                            scrollbar: false,
                            area: ['560px', '380px'],
                            content: 'quote.html?id=' + id,
                            btn: ['发送', '取消'],
                            yes: function (index, layero) {
                                //do something
                                var body = layer.getChildFrame('body', index);
                                var id = body.find('#id').val();
                                var user_uid = body.find('#user_uid').val();
                                var store = body.find('#store').val();
                                layer.close(index);//如果设定了yes回调，需进行手工关闭
                                $.ajax({
                                    type: "get",
                                    url: "{:url('api/trading/trading_quote')}",
                                    data: {'mid': id, 'uid': user_uid, 'store': store},
                                    dataType: 'jsonp',
									beforeSend: function () {
									var index = layer.load(1, {
										shade: [0.1, '#333333'] //0.1透明度的白色背景
									});
									},
                                    success: function (msg) {
										layer.closeAll();
                                        if (msg.code == 200) {
                                            layer.msg('报价成功！', {icon: 1});
                                        } else {
                                            layer.msg(msg.message, {icon: 5});
                                        }
                                    }
                                });
                            }
                        });
                    } else if (msg.code == 1000) {
                        layer.msg(msg.message, {icon: 5});
                    }
                }
            });
        } else {
            layer.msg('你还没有登录！', {icon: 51});
        }
    })
    ;
    /*收藏*/
    $('.collectArea').on('click', function () {
        if ($('span.isCollect').text() == '已收藏') {
            return false;
        }
        var userinfo = $.cookie('userinfo');
        if (userinfo) {
            var user_login = $.base64.decode(userinfo).split(",");
            var goods_uid = user_login[0];
            $.ajax({
                type: "get",
                url: "/index.php/api/trading/goods_collect",
                data: {'id': id, 'uid': goods_uid},
                dataType: 'jsonp',
                success: function (msg) {
                    if (msg.code == 200) {
                        $('.icon-collect01').addClass('hide');
                        $('.icon-collect01-hover').addClass('hide');
                        $('.icon-collect01-success').removeClass('hide');
                        isCollect = true;
                        collect = 1;
                        $('.isCollect').text('已收藏');
                        $('.isCollect').css('color', '#3377C1');
                        layer.open({
                            type: 2,
                            title: '收藏成功',
                            fix: false,
                            maxmin: true,
                            shadeClose: true,
                            scrollbar: false,
                            area: ['560px', '330px'],
                            content: 'collect_success.html',
                            //				btn: ['发送', '取消'],
                            yes: function (index, layero) {
                                //do something

                                layer.close(index); //如果设定了yes回调，需进行手工关闭
                            }
                        });
                    }
                    if (msg.code == 1000) {
                        layer.msg(msg.message, {icon: 5});
                    }
                    if (msg.code == 1001) {
                        //layer.msg(msg.message, {icon: 6});
                        layer.open({
                            type: 2,
                            title: '商品已被收藏',
                            fix: false,
                            maxmin: true,
                            shadeClose: true,
                            scrollbar: false,
                            area: ['560px', '330px'],
                            content: 'collect_success.html',
                            //				btn: ['发送', '取消'],
                            yes: function (index, layero) {
                                //do something

                                layer.close(index); //如果设定了yes回调，需进行手工关闭
                            }
                        });
                    }
                }
            });
        } else {
            layer.msg('你还没有登录！', {icon: 51});
        }
    });


</script>
{/block}